package com.agh.portal.domain.util;

import java.util.List;
import java.util.Set;

public class ToStringUtil {
	
	public static <T> String toString(Set<T> entities){
		String result =  "[ ";
		for(T entity : entities){
			result += entity.toString() + ", ";
		}
		result += "]";
		return result;
	}
	
	public static <T> String toString(List<T> entities){
		String result =  "[ ";
		for(T entity : entities){
			result += entity.toString() + ", ";
		}
		result += "]";
		return result;
	}
	
	public static String cutString(String s, int lenght){
        if(s.length() <= lenght){
            return s;
        }
        return s.substring(0, lenght) + "...";
	}

}
